<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
.edittable td{padding:5px 5px;}
.shop_data{padding-right:80px;}
.shop_data div{
    border: 1px dotted #aaa;
    cursor: pointer;
    display: inline-block;
    font-size: 15px;
    line-height: 30px;
    margin-bottom: 4px;
    margin-right: 2px;
    padding-left: 4px;
}
.selected{background-color:#e74003}
</style>
<title>添加新的商品</title>
<body class="withvernav">
<div class="bodywrapper">
 {{include file='/public/leftmenu.tpl'}}
    <div class="centercontent">
    
       <div class="pageheader notab">
            <h1 class="pagetitle">添加新销售项目</h1>
      <span class="pagedesc"></span>
            <div class="menulist">
        		<ul class="profile_summary">
                        <li><a href="/sales/salesProgramList">销售项目列表</a></li>
                        
                    </ul>
               </div>
        </div><!--pageheader-->
        	
        <div id="contentwrapper" class="contentwrapper">
        	<div id="basicform" class="subcontent">
					<form class="stdform stdform2"  id="otherForm" method="post" enctype='multipart/form-data' action="/sales/ajaxbutton?op=saveProgram">
                    	
                   	  <table width="100%" class="edittable" border="1" style="background-color:#ccc;"  cellspacing="1" cellpadding="0">
                          <tr>
                            <td width="210" bgcolor="#FFFFFF">项目名称</td>
                            <td bgcolor="#FFFFFF">
                              <input type="text" name="program_name" id="program_name" class="width300" value="{{$info.program_name}}" onBlur="getsku()" required></td>
                          </tr>
                          <tr>
                            <td bgcolor="#FFFFFF">项目负责人</td>
                            <td bgcolor="#FFFFFF">
                              <select name="department_id" id="department_id" class="selection department" style="width:120px;">
                            <option value="" {{if $info.department_id==""}} selected{{/if}}>请选择</option>
                            {{foreach from=$department item=li key=_key}}
                            	<option value="{{$li.id}}" {{if $info.department_id==$li.id}} selected{{/if}}>{{$li.name}}</option>
                            {{/foreach}}
                        </select> <select name="owner" id="owner" style="width:120px;">
                            <option value="" {{if $status==""}} selected{{/if}}>--负责人--</option>
                            {{foreach from=$ownerlist item=li key=_key}}
                            	<option value="{{$li.id}}" {{if $info.owner==$li.id}} selected{{/if}}>{{$li.name}}</option>
                            {{/foreach}}
                        </select></td>
                          </tr>
                          <tr>
                            <td bgcolor="#FFFFFF">项目关联店铺</td>
                            <td bgcolor="#FFFFFF"><div class="shop_data">{{$shop_data}}</div></td>
                          </tr>

                          <tr>
                            <td colspan="2" bgcolor="#FFFFFF" align="center">
                        	<button type="button" class="submit radius2" id="btn" onClick="saveform()" >确定提交</button>
                            <input type="hidden" name="id" value="{{$info.id}}" id="id">
                            <input type="hidden" name="history_url" value="{{$history_url}}" id="history_url">
                            </td>
                          </tr>
                        </table>
              </form>
					
                    <br />

            </div><!--subcontent-->
            
            <!--subcontent-->
        
        </div><!--contentwrapper-->
        
	</div><!-- centercontent -->
    
    
</div><!--bodywrapper-->
<script type="text/javascript">
	$(function () {
		$(".department").live('change',function(){//获取部门人员
			var deptval = $(this).val();
			$.post("/sales/ajaxbutton?op=getUserlist",{dept:deptval},function(ret){
				if(ret.state==1){
					var userlist=ret.data;
					var str='';
					for(var i=0;i<userlist.length;i++){
						str+="<option value='"+userlist[i]['id']+"'>"+userlist[i]['name']+"</option>";
					}
					if(userlist.length<1){
						str+="<option value=''>-暂无人员-</option>";
					}
					$("#owner").html(str);
				}else{
					alert(ret.msg);
				}
			},'json');
		});
	});
	
	//
	function saveform(){
		$("#otherForm").submit();	
	}


	function checkBox(tagid){
		if($("#"+tagid).attr("checked")=="checked"){

			$("#"+tagid).attr("checked",false);
			$("#"+tagid).parent().css("background","#fff");
		}else{
			//alert('in here');
			$("#"+tagid).parent().css("background","#e74003");
			$("#"+tagid).attr("checked",true);
		};
	}
</script>
</body>
</html>
